#pragma once

#include "Collaboration.h"

#include "ConnectableElement.h"

namespace uml {

Collaboration::Collaboration(const QString& umlType)
    : Classifier(umlType) {}

void Collaboration::fromJson(const QJsonObject& json, QStringList& errorList) {
    if (json.isEmpty()) {
        return;
    }

    Classifier::fromJson(json, errorList);
    BehavioredClassifier::fromJson(json, errorList);
    StructuredClassifier::fromJson(json, errorList);
    JsonSerializable::fromJsonArray(collaborationRoles_, "collaborationRoles", json, errorList);
}

void Collaboration::toJson(QJsonObject& json) {
    Classifier::toJson(json);
    BehavioredClassifier::toJson(json);
    StructuredClassifier::toJson(json);
    JsonSerializable::toJsonArray(collaborationRoles_, "collaborationRoles", json);
}

/// <summary>
/// collaborationRoles getter
/// Represents the participants in the Collaboration.
/// </summary>
vector<shared_ptr<ConnectableElement>>& Collaboration::collaborationRoles() {
    return collaborationRoles_;
}

} // namespace uml
